package com.feituan.wx.controller;


import com.feituan.core.persistence.service.IProductService;
import com.feituan.core.pojo.entity.Product;
import com.feituan.core.pojo.request.CommonPageReq;
import com.feituan.core.pojo.response.Response;
import com.feituan.core.pojo.response.page.PageData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xiaohu
 * @since 2024-05-09
 */
@RestController
@RequestMapping("/product")
@Api(tags = "商品管理")
public class ProductController extends BaseController{
    @Autowired
    private IProductService iProductService;
    @PostMapping("/list_page")
    @ApiOperation("")
    public Response<PageData<Product>> listPage(@Valid CommonPageReq request) {
        setDefaultPageParameters(request);
        return Response.success(iProductService.queryPage(request));
    }

    /**
     * 根据ids查询商品信息
     * @param ids ids
     */
    @PostMapping("/selectInfoByIds")
    public Response<List<Product>> selectInfoByIds(String ids) {
        return Response.success(iProductService.selectInfoByIds(ids));
    }
    

}
